/*
APPENDING DS_JOBB DATASETS

Data 	: DS_Lev_Jobb2000.dta  to  DS_Lev_Jobb2013.dta
Folder 	: rawdata/dtafiles/DS_Lev_Jobb2000.dta
Date	: 2016-12-06

Creator		: Jonas Cederlof (JC)
Description 	: Appending the years 1985-2018 of Jobb data. This is done ONLY 
		  for indiviuals who are present in the notification data
	
Notes		: 36 indivuals not found in Jobb data (see note at end of .do-file).
LATEST UPDATE 	: 2021-10-06
*/

********************************************************************************
clear
set more		 off
cap   log close 	_all
log using 	"../log/A0_append_RAMS.log", replace 

{ // Appending all years of Jobb data (1985 to 2018)
*===============================================================================

*Open 1985 Jobb data
use 		"$rawdatapath/jobb_1985.dta", clear


*Appending 1986 to 2013 for indivuals present in displacement data
forvalues i = 1986(1)2018 {
	append using "$rawdatapath/jobb_`i'.dta"
}
	append using "$datapath/A0_jobb2019.dta"
}
*

{ // Merge on and keep only workers from the notification data
*===============================================================================
merge m:1 lopnr using "$datapath/A0_persid_varsel.dta"
keep if _merge==3
drop 	_merge

* NOTE:
* In the last merge 36 indiviuals in the varsel data has no observations in the
* 26 years of Jobb data.
}
*

*Save
compress
save		 "$datapath/A0_RAMS_85_19.dta", replace


log close
